var userCode=null
var userName=null
var gender=null
var birthday=null
var phone=null
var address=null
var saveButtun=null
var datetimeStart=null

function priceReg (value){
    value = value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符
    value = value.replace(/^\./g,"");  //验证第一个字符是数字而不是.
    value = value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的.
    value = value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");//去掉特殊符号￥
    if(value.indexOf(".")>0){
        value = value.substring(0,value.indexOf(".")+3);
    }
    return value;
}

$(function (){
    userCode=$("#userCode")
    userName=$("#userName")
    gender=$("#gender")
    birthday=$("#birthday")
    phone=$("#phone")
    address=$("#address")
    saveButtun=$("#save")
    datetimeStart=$("#datetimeStart")

    phone.next().html("*")

    phone.on("focus",function(){
        validateTip(proPhone.next(),{"color":"#666666"},"* 请输入手机号",false);
    }).on("blur",function(){
        var patrn=/^(1[0-9][0-9]|15[0-9]|18[0-9])\d{8}$/;
        if(proPhone.val().match(patrn)){
            proPhone.next().css({"color": "green"});
            proPhone.next().html("* √");
        }else{
            proPhone.next().css({"color": "red"});
            proPhone.next().html("* 您输入的手机号格式不正确");
        }
    }).focus();

    saveButtun.on("click",function(){
        if(confirm("是否确认提交数据")){
            swal('修改成功！','','success').then(function () {
                $("#userForm").submit();
            });
        } else {
            swal("请填写正确信息！","","info");
        }
    });
})
